/**
 * Created by AllanXu on 01/03/2016.
 */
define(function (require) {
	var Vue = require('vue'),
        Config = require('config'),
		_ = require('ajax'),
		utilities = require('utilities');

	var app = new Vue({
		el: '#uc_account_appeal',
		data: {
			str: '',
			appealList: []
		},
		methods:{
			submit: function () {
                _(Config.SERVICE.USERCENTER.ACCOUNT_APPEAL, {
					'appeal.basicA.id': sessionStorage.id,
					'appeal.content': app.str
				}, function(data) {
					if(data.code == 200 && data.type === 'SUCCESS'){
						alert('保存成功！');
						utilities.refreshUserInfo(function (data) {
							history.back();
						});
					}
                });
			},
			init: function(){
				_(Config.SERVICE.USERCENTER.ACCOUNT_APPEAL_RECORD, {
					id: sessionStorage.id,
					pageno: 1,
					pagesize: 999
				}, function(data) {
					console.log(data);
					app.appealList = data.pageitems;
				});
			}
		}
	});

	app.init();
});
